def change(arr: list, l: int, r: int):
    t: int = arr[l]
    arr[l] = arr[r]
    arr[r] = t

def check(arr:list):
    global end
    for i in range(len(arr)):
        if arr[i] != end[i]: return False
    return True

start = []
for i in input():
    start.append(i)
end = []
for i in input():
    end.append(i)
print(start, end)
queen = []
queen.append(start)
step = 0
while len(queen) > 0:
    n = queen[0].copy
    pos = n.index('*')
    for i in range(-3, 4):
        if i == 0: continue
        if pos + i >= len(queen) or pos + i < 0: continue
        step += 1
        change(n, pos, pos + i)
        queen.append(n.copy)
        change(n, pos, pos + i)
        step -= 1
    queen.pop(0)
